#@public@|cmd_info|Shows detailed information for a command
#@public_detailed@|cmd_info|Syntax 'make cmd_info cmd=<cmd> cmd_info'
#@public_detailed@|cmd_info|Where <cmd> is a valid command. Please, run the command 'make cmd_list' to show all the avaiable commands
cmd_info: 01_setup
	$(00_show) ""                                                           ; \
	echo "------------------------------------------------------------"  ; \
	echo "Detailed information for command '$(00_cmd)'"                     ; \
	echo "------------------------------------------------------------"  ; \
	tmp=`echo "$(00_cmd)" | cut -d '_' -f 1`                                ; \
	mk_file="*_$$tmp".mk                                                 ; \
	cd mk                                                                ; \
	found=`grep -c "#@public@|$(00_cmd)|" $$mk_file`                        ; \
	if [ $$found -eq 1 ]; then                                             \
		grep "#@public_detailed@|$(00_cmd)" $$mk_file | while read line ; do  \
			c=`echo $$line | cut -d '|' -f 2`                    ; \
			if [ "$$c" = "$(00_cmd)" ]; then                          \
				desc=`echo $$line | cut -d '|' -f 3`         ; \
				if [ "$$desc" = "describe-common-parameters" ]; then  \
					echo "Where <project-name> is an existing project. Please rum 'make prj_list' to list all the avaiable projects." | $(00_line_formater) ; \
					echo "Where <cpu-os-compiler> is the name of a file that contain definitions for a CPU, OS and compiler. Please, run 'make coc_list' to list all the combinations avaiables. If none is provided, it is used 'x86_linux_g++'. The 'cpu-os-compiler' files are 'tenacitas/dev/cpp/prj/tenacitas/cpu_os_comp' directory." | $(00_line_formater) ; \
					echo "Where 'verbose' indicates the amount of information about the command being executed that will be displayed." | $(00_line_formater) ; \
					echo "Where 'target' defines if 'debug' or 'release' options should be generated." | $(00_line_formater) ; \
				else                                           \
					common_syntax=`echo "$$desc" | grep -c common-cmd-syntax` ; \
					if [ $$common_syntax -eq 1 ]; then     \
						new_desc=`echo $$desc | sed 's/common-cmd-syntax/\make project\=\<project-name\> \[coc\=\<cpu-os-compiler\>\] \[verbose\=0\/1\] \[target\=debug\/release\]/g'`;    \
					else                                   \
						new_desc=$$desc              ; \
					fi                                   ; \
					echo "$$new_desc" | $(00_line_formater) ; \
				fi                                           ; \
			fi                                                   ; \
		done                                                         ; \
	fi                                                                   ;




#@public@|cmd_list|Lists all the commands avaiable
#@public_detailed@|cmd_list|Syntax 'make cmd_list'
cmd_list:
	$(00_show) ""                                                           ; \
	echo "------------------------------------------------------------"  ; \
	echo "Lists all commands available"                                  ; \
	echo "------------------------------------------------------------"  ; \
	echo ""                                                              ; \
	for mk in `find $(00_dir_tool)/mk/*.mk` ; do                              \
		tmp=`echo "$$mk" | cut -d '_' -f 2`                          ; \
		aux1=`basename $$tmp .mk`                                    ; \
		if [ $$aux1 != "basic" -a $$aux1 != "cmd" -a  $$aux1 != "info" \
                     -a  $$aux1 != "main" -a  $$aux1 != "private"              \
                     -a  $$aux1 != "public" -a  $$aux1 != "common" ]; then     \
			aux2=`echo $$aux1 | tr '[:lower:]' '[:upper:]'`      ; \
			echo ""                                              ; \
			echo "==========  $$aux2  =========="                ; \
			cmd_before=""                                        ; \
			cat $$mk | grep "@public@|" | while read line ; do     \
				cmd=`echo $$line | cut -d '|' -f 2`          ; \
				if [ "$$cmd" != "$$cmd_before" ]; then         \
					echo ""                              ; \
					echo ""                              ; \
					echo -n "'$$cmd': "                  ; \
					cmd_before="$$cmd"                   ; \
				fi                                           ; \
				desc=`echo $$line | cut -d '|' -f 3`         ; \
				echo "$$desc" | $(00_line_formater)             ; \
			done                                                 ; \
		fi                                                           ; \
	done                                                                 ; \
	echo ""                                                              ; \
	echo "------------------"                                            ; \
	echo "ATTENTION"                                                     ; \
	echo "------------------"                                            ; \
	echo "Please run 'make cmd_info cmd=<cmd-name>' for detailed information on a command" ;






